package main;

import model.ServerModel;
import utils.Constants;
import view.ServerView;
import controller.ServerController;;

public class ServerMain {

    public static void main(String[] args) {
        if (checkArgs(args)) {
            ServerModel serverModel = new ServerModel(Integer.parseInt(args[0]));
            ServerView serverView = new ServerView();
            ServerController serverController = new ServerController(
                    serverModel, serverView);
            serverController.start();
            System.out.println("\nServidor finalizado!");
        } else {
            System.out.println(Constants.ERROR_SERVER_ARGS);
        }
    }
    
    private static boolean checkArgs(String[] args) {
        if (args.length == 1) {
            return true;
        } else {
            return false;
        }
    }
    
}
